package com.regent.central.bill.service.bean;

import com.regent.central.bill.core.CreateGoods;
import com.regent.central.bill.repository.CreateGoodsMapper;
import com.regent.central.bill.service.CreateGoodsService;
import com.regent.central.infrastructure.service.bean.DomainServiceBean;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CreateGoodsServiceBean extends DomainServiceBean<CreateGoodsMapper, CreateGoods> implements CreateGoodsService {
    /**
     * 删除开单货品
     *
     * @param createGoodsId 开单货品ID
     * @param userDeleted   删除人
     */
    @Override
    public void delete(String createGoodsId, String userDeleted) {
        mapper.hide(createGoodsId, userDeleted, System.currentTimeMillis());
    }

    /**
     * 根据开单动作ID删除开单货品
     *
     * @param createActionId 开单动作ID
     * @param userDeleted    删除人
     */
    @Override
    public void deleteForSaleOrderCreateAction(String createActionId, String userDeleted) {
        mapper.deleteForSaleOrderCreateAction(createActionId, userDeleted, System.currentTimeMillis());
    }

    /**
     * 获取销售单的开单要货
     *
     * @param saleOrderId 销售单ID
     * @return 销售单的开单要货
     */
    @Override
    public List<CreateGoods> getSaleOrderCreateGoods(String saleOrderId) {
        return getSaleOrderCreateGoods(saleOrderId, false, false);
    }

    /**
     * /**
     * 获取销售单的开单要货
     *
     * @param saleOrderId 销售单ID
     * @param canceled    已撤销
     * @param deleted     已删除
     * @return 销售单的开单要货
     */
    @Override
    public List<CreateGoods> getSaleOrderCreateGoods(String saleOrderId, Boolean canceled, Boolean deleted) {
        return mapper.getSaleOrderCreateGoods(saleOrderId, canceled, deleted);
    }

}